package com.atguigu.hellomp.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;

import java.time.LocalDateTime;

/**
 *    AUTO(0), 自增
 *     NONE(1), 未设置主键
 *     INPUT(2), 手动插入
 *     ASSIGN_ID(3),
 *     ASSIGN_UUID(4);
 */
@Data
@TableName("user")
public class User {

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @TableField("name")
    private String name;

    @TableField("age")
    private Integer age;

    @TableField("email")
    private String email;

    @TableLogic
    private Integer deleted;

    @Version
    private Integer version;

    // 字段填充，需要处理器处理此注解
    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createTime;
    // 插入时同时更新
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;
}